<template>
    <view class="uni-container">
        <uni-forms ref="baseForm" :model="formData" :rules="rules" label-align="left" label-width="110px"
                   err-show-type="toast" class="">
            <uni-forms-item label="提现金额(元)" name="amount">
                <uni-easyinput v-model="formData.amount" type="number" placeholder="请输入" />
            </uni-forms-item>
            <uni-forms-item label="银行账号" name="bankAccountNumber">
                <uni-easyinput v-model="formData.bankAccountNumber" type="number" placeholder="请输入" />
            </uni-forms-item>
            <uni-forms-item label="银行账户名" name="bankAccountName">
                <uni-easyinput v-model="formData.bankAccountName" placeholder="请输入" />
            </uni-forms-item>
        </uni-forms>

        <view @click="withdrawDepositApply()" class="uni-btn" style="margin-top:50px;">提交</view>
    </view>
</template>

<script>
import { UserApi } from '@/api/user/UserApi'

export default {
    data() {
        return {
			Config: this.$Config,
			Common: this.$Common,
			Auth: this.$Auth,
			ShareUtil: this.$ShareUtil,
			State: this.$store.state,
			Dict: this.$Dict,

            formData:{
                amount:'',
                bankAccountNumber:'',
                bankAccountName:'',
                remark:''
            },
            rules: {
                amount: {
                    rules: [{
                        required: true,
                        errorMessage: '请填写提现金额'
                    }, {
                        format: "number",
                        errorMessage: '金额为数字'
                    }, {
                        minimum: 50,
                        errorMessage: '最低提现{minimum}元'
                    }]
                },
                bankAccountNumber: {
                    rules: [{
                        required: true,
                        errorMessage: '请填写银行账号'
                    }, {
                        format: "number",
                        errorMessage: '银行账号为数字'
                    }]
                },
                bankAccountName: {
                    rules: [{
                        required: true,
                        errorMessage: '请填写银行账户名'
                    }]
                },
            },

        }
    },
    onLoad() {

    },
    onReady() {
    },
    methods: {
        withdrawDepositApply() {
            let that = this

            this.$refs.baseForm.validate().then(res => {
                let data = that.Common.deepClone(that.formData)
                data.amount = data.amount * 100
                UserApi.withdrawDepositApply(data).then((Response) => {
                    uni.showModal({
                        title: '提示',
                        content: '申请成功，请等待审核...',
                        showCancel: false,
                        success: function (res) {
                            that.Common.navigateBackRefresh()
                        }
                    })
                })
            })
        }
    }
}
</script>

<style lang="scss" scoped>
page{ background: #FFF;}

::v-deep .uni-forms-item {border-bottom:1px solid #F2F2F2;padding:26rpx 0 8rpx 0;margin:0rpx !important;}
::v-deep .is-input-border {border:none !important;}
::v-deep .input-value-border {border:none !important;}
::v-deep .uni-forms-item__label {font-size:32rpx !important;}
::v-deep .default-address {text-align:right;}
::v-deep .uni-easyinput__content-input {font-size:32rpx !important;}
::v-deep .input-value {padding:0 20rpx !important;}
::v-deep .selected-list {padding:0rpx !important;}
::v-deep .selected-list text {font-size:32rpx !important;}
::v-deep .uniui-clear {font-size:24px !important;color:#c0c4cc !important;}
::v-deep .uni-data-tree-input .input-value {padding-right:5px !important;}
::v-deep .uni-forms-item .is-required {display:none !important;}

</style>
